package com.water.service.impl;

import com.water.dao.PyBalancedetailDao;
import com.water.entity.PyBalancedetail;
import com.water.service.PyBalancedetailService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * (PyBalancedetail)表服务实现类
 *
 * @author makejava
 * @since 2020-12-22 18:39:15
 */
@Service("pyBalancedetailService")
public class PyBalancedetailServiceImpl implements PyBalancedetailService {
    @Resource
    private PyBalancedetailDao pyBalancedetailDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public PyBalancedetail queryById(Integer id) {
        return this.pyBalancedetailDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<PyBalancedetail> queryAllByLimit(int offset, int limit) {
        return this.pyBalancedetailDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param pyBalancedetail 实例对象
     * @return 实例对象
     */
    @Override
    public PyBalancedetail insert(PyBalancedetail pyBalancedetail) {
        this.pyBalancedetailDao.insert(pyBalancedetail);
        return pyBalancedetail;
    }

    /**
     * 修改数据
     *
     * @param pyBalancedetail 实例对象
     * @return 实例对象
     */
    @Override
    public PyBalancedetail update(PyBalancedetail pyBalancedetail) {
        this.pyBalancedetailDao.update(pyBalancedetail);
        return this.queryById(pyBalancedetail.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.pyBalancedetailDao.deleteById(id) > 0;
    }

}